﻿@{
    Layout = "_ConfigurePlugin";
}
@model ConfigurationModel
@using Grand.Plugin.Payments.PayPalStandard.Models;
@using Grand.Framework;
@await Component.InvokeAsync("StoreScopeConfiguration")

<form asp-controller="PaymentPayPalStandard" asp-action="Configure" method="post">
    
    <div class="form-horizontal">
        <div class="form-body">
            <div class="note note-info">
                <b>
                    If you're using this gateway ensure that your primary store currency is supported
                    by Paypal.
                </b>
                <br />
                <br />
                To use PDT, you must activate PDT and Auto Return in your PayPal account profile.
                You must also acquire a PDT identity token, which is used in all PDT communication
                you send to PayPal. Follow these steps to configure your account for PDT:
                <br />
                <br />
                1. Log in to your PayPal account.
                <br />
                2. Click the Profile subtab.
                <br />
                3. Click Website Payment Preferences in the Seller Preferences column.
                <br />
                4. Under Auto Return for Website Payments, click the On radio button.
                <br />
                5. For the Return URL, enter the URL on your site that will receive the transaction
                ID posted by PayPal after a customer payment (http://www.yourStore.com/PaymentPayPalStandard/PDTHandler).
                <br />
                6. Under Payment Data Transfer, click the On radio button.
                <br />
                7. Click Save.
                <br />
                8. Click Website Payment Preferences in the Seller Preferences column.
                <br />
                9. Scroll down to the Payment Data Transfer section of the page to view your PDT
                identity token.

                <br />
                <br />
                <b>Two ways to be able to receive IPN messages (optional, new Dictionary&lt;string, object&gt; { { "class", "control-label" } }, false)</b>
                <br />
                <br />
                <b>The first way is to check 'Enable IPN' below.</b> It will include in the request the url of you IPN handler

                <br />
                <br />
                <b>The second way is to confugure your paypal account to activate this service</b>; follow these steps:
                <br />
                1. Log in to your Premier or Business account.
                <br />
                2. Click the Profile subtab.
                <br />
                3. Click Instant Payment Notification in the Selling Preferences column.
                <br />
                4. Click the 'Edit IPN Settings' button to update your settings.
                <br />
                5. Select 'Receive IPN messages' (Enabled) and enter the URL of your IPN handler (http://www.yourStore.com/PaymentPayPalStandard/IPNHandler).
                <br />
                6. Click Save, and you should get a message that you have successfully activated IPN.
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.UseSandbox_OverrideForStore, model => model.UseSandbox, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="UseSandbox" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                        <admin-input asp-for="UseSandbox" />
                         <div class="control__indicator"></div>
                    </label>
                    <span asp-validation-for="UseSandbox"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.BusinessEmail_OverrideForStore, model => model.BusinessEmail, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="BusinessEmail" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="BusinessEmail" />
                    <span asp-validation-for="BusinessEmail"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.PdtToken_OverrideForStore, model => model.PdtToken, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="PdtToken" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="PdtToken" />
                    <span asp-validation-for="PdtToken"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.PdtValidateOrderTotal_OverrideForStore, model => model.PdtValidateOrderTotal, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="PdtValidateOrderTotal" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                        <admin-input asp-for="PdtValidateOrderTotal" />
                         <div class="control__indicator"></div>
                    </label>
                    <span asp-validation-for="PdtValidateOrderTotal"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.AdditionalFee_OverrideForStore, model => model.AdditionalFee, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="AdditionalFee" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <admin-input asp-for="AdditionalFee" />
                    <span asp-validation-for="AdditionalFee"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.AdditionalFeePercentage_OverrideForStore, model => model.AdditionalFeePercentage, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="AdditionalFeePercentage" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                        <admin-input asp-for="AdditionalFeePercentage" />
                         <div class="control__indicator"></div>
                    </label>
                    <span asp-validation-for="AdditionalFeePercentage"></span>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-3 col-sm-3 text-right">
                    @Html.OverrideStoreCheckboxFor(model => model.PassProductNamesAndTotals_OverrideForStore, model => model.PassProductNamesAndTotals, Model.ActiveStoreScopeConfiguration)
                    <admin-label asp-for="PassProductNamesAndTotals" class="control-label" />
                </div>
                <div class="col-md-9 col-sm-9">
                    <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
                        <admin-input asp-for="PassProductNamesAndTotals" />
                         <div class="control__indicator"></div>
                    </label>
                    <span asp-validation-for="PassProductNamesAndTotals"></span>
                </div>
            </div>
        </div>
        <div class="form-actions">
            <div class="row">
                <div class="col-md-offset-3 col-sm-offset-3 col-md-9 col-sm-9">
                    <input type="submit" name="save" class="btn green" value="@T("Admin.Common.Save")" />
                </div>
            </div>
        </div>
    </div>
</form>
